<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>cors解决跨域问题</title>
	<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>
<body>
	<button id="get">GET请求</button>
	<button id="post">POST请求</button>
	<script>
		let getButton = document.getElementById('get');
		let postButton = document.getElementById('post');
		getButton.onclick = async function() {
			let result = await axios.get('http://127.0.0.1/');
			console.log(result);
		}
		postButton.onclick = async function() {
			let result = await axios.post('http://127.0.0.1/');
			console.log(result);
		}
	</script>
</body>
</html>